package com.spacing.app;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import android.widget.ImageView;
import android.widget.Button;

import com.actionbarsherlock.app.SherlockFragment;
import com.senseilearning.spanish.R;


public class WalkthroughFragment extends SherlockFragment{
	public static final String ARG_OBJECT = "object";

    @Override
    public View onCreateView(LayoutInflater inflater,
            ViewGroup container, Bundle savedInstanceState) {
        // The last two arguments ensure LayoutParams are inflated
        // properly.
        View rootView = inflater.inflate(
                R.layout.walkthroughitem, container, false);
        Bundle args = getArguments();
		String uri = "drawable/"+args.getString("filePrefix")+(Integer.toString(args.getInt(ARG_OBJECT)));
//		String uri = "drawable/w01";
		
		int imageResource = getResources().getIdentifier(uri, null, getActivity().getPackageName());
		Drawable image = getResources().getDrawable(imageResource);
		((ImageView) rootView.findViewById(R.id.walkimage)).setImageDrawable(image);
		
		if(args.getInt(ARG_OBJECT) == args.getInt("nrOfPages")) {
			((Button) rootView.findViewById(R.id.walkButton)).setVisibility(View.VISIBLE);
		}

        return rootView;
    }


}
